Title Banner

Previous Book Contents Book Index Next

Inside Macintosh: QuickTime Components /
Chapter 11 - Clock Components / Clock Components Reference
Clock Component Functions / Using the Callback Functions


ClockNewCallBack

Your component's ClockNewCallBack function allocates the memory for a new callback event. The Movie Toolbox calls this function when an application defines a time base callback event with the Movie Toolbox's NewCallBack function. The callback event created at this time is not active until it has been scheduled. An application schedules a callback event by calling the Movie Toolbox's CallMeWhen function.

Your component allocates the memory required to support the callback event. The memory must be in a locked block and must begin with a callback header structure. This structure is described in "Data Type," which begins on page 11-5.

You should not call this function at interrupt time.

pascal QTCallBack ClockNewCallBack (ComponentInstance aClock,
                                    TimeBase tb, 
                                    short callBackType);
aClock
Specifies the clock for the operation. Applications obtain this identifier from the Component Manager's OpenComponent function.
tb
Specifies the callback event's time base. Typically, your component does not need to save this specification. You can use the Movie Toolbox's GetCallBackTimeBase function to determine the callback event's time base when it is invoked (see the discussion of time bases in the chapter "Movie Toolbox" in Inside Macintosh: QuickTime for more information about this function).
callBackType
Specifies when the callback event is to be invoked. The value of this field governs how your component interprets the data supplied in the param1, param2, and param3 parameters to the ClockCallMeWhen function, which is described in the next section. The following three values are valid for this parameter:
callBackAtTime

Indicates that the callback event is to be invoked at a specified time. The Movie Toolbox supplies this time to your component in the parameter data of the ClockCallMeWhen function (described in the next section).
callBackAtRate

Indicates that the callback event is to be invoked when the rate for the time base reaches a specified value. The Movie Toolbox supplies this value to your component in the parameter data of the ClockCallMeWhen function.
callBackAtTimeJump
Indicates that the callback event is to be invoked when a program changes the time value for the time base.
In addition, if the high-order bit of the callBackType parameter is set
to 1 (this bit is defined by the callBackAtInterrupt flag), the callback event may be invoked at interrupt time.
DESCRIPTION
Your clock component allocates the memory for the event and returns a pointer to that memory. If your clock component cannot satisfy the request or detects invalid or unsupported parameter values, you should set the QTCallBack result to nil.

Your component can allocate an arbitrarily large piece of memory for the callback event. That memory must begin with a callback header structure, which must be initialized to 0.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996




Navigation graphic, see text links

Main | Top of Section | What's New | Apple Computer, Inc. | Find It | Feedback | Help